#include<iostream>
#include<string>
#include"log.hpp"
#include"comm.hpp"
#include<cstring>
Log lg;
int main()
{
    int fd=open(MYFIFO,O_WRONLY);
    if(fd<0)
    {
       lg(Fatal,"open fail,strerr:%s,error code:%d",strerror(errno),errno);
       exit(FIFO_OPEN_ERR); 
    }
    lg(Info,"client open done");
    //开始通信
    std::string line;
    while(true)
    {
        std::cout<<"Please Enter# ";
        getline(std::cin,line);
        int s=write(fd,line.c_str(),line.size());
        if(s<0)
        {
            lg(Fatal,"strerr:%s,error code:%d",strerror(errno),errno);
            return 1;
        }

    }
    close(fd);
    return 0;
}